﻿using Batman.ImportExport.Web.BLL;
using Batman.ImportExport.Web.Models;
using Microsoft.AspNetCore.Mvc;

namespace Batman.ImportExport.Web.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }

        public IActionResult DoImport()
        {
            var stream = Request.Form.Files[0].OpenReadStream();
            var collection = new ImportBLL().DoImport(stream);
            var entities = collection.ToEntities<HouseEntity>();
            return Json(collection);
        }
    }
}
